//-------Ambient Initialization---------//

    inline int startInterval()
    {
        int mode = fegetround();

        fesetround(FE_DOWNWARD);
        return mode;
    }

    inline void stopInterval(int mode)
    {
        fesetround(mode);
    }   
//-------Ambient Initialization---------//


    //Constructor
    inline f_interval::f_interval(const real &a, const real &b)
    {
        inf = a;
        nsup = -b;    
    }

    //Constructor
    inline f_interval& f_interval::operator= (const real& a)
    {
        inf = a;
        nsup = -a;
        return *this;
    }

//------------------Mathematical Functions---------------------//

    //Standard Negative signal operation
    inline f_interval operator -(const f_interval &a)
    {
        f_interval help;
        help.inf = a.nsup;
        help.nsup = a.inf;
        return help;
    }

    //Standard Positive signal operation
    inline f_interval operator +(const f_interval &a)
    { 
       return a;
    }
    /*Returns the convex hull of the arguments*/
    inline f_interval operator |(const f_interval &a, const f_interval &b)
    {
        return f_interval((a.inf<b.inf)?a.inf:b.inf,(a.nsup>b.nsup)?-a.nsup:-b.nsup);
    }
    
    /*Returns the intersection of the arguments*/
    inline f_interval operator &(const f_interval &a, const f_interval &b)
    {
        return f_interval((a.inf>b.inf)?a.inf:b.inf,(a.nsup<b.nsup)?-a.nsup:-b.nsup);
    }
    
    inline f_interval operator +=(f_interval &a, const f_interval &b)
    {
        return a=a+b;
    }
    inline f_interval operator -=(f_interval &a, const f_interval &b)
    {
        return a=a-b;
    }
    inline f_interval operator *=(f_interval &a, const f_interval &b)
    {
        return a=a*b;
    }
    
    
    //Returns the convex hull of the arguments
    inline f_interval operator |(const real &a, const f_interval &b)
    {
        return f_interval((a<b.inf)?a:b.inf,(a>(-b.nsup))?a:-b.nsup);
    }
    
    //Returns the convex hull of the arguments
    inline f_interval operator |(const f_interval &a, const real &b)
    {
        return f_interval((a.inf<b)?a.inf:b,(-a.nsup>b)?-a.nsup:b);
    }
    
    //Returns the convex hull of the arguments
    inline f_interval operator |(const real &a, const real &b)
    {
        if(a>b)
            return f_interval(b,a);
        else
            return f_interval(a,b);
    }
    
    
    //Returns the intersection of the arguments
    inline f_interval operator &(const real &a, const f_interval &b)
    {
        return f_interval((a>b.inf)?a:b.inf,(a<-b.nsup)?a:-b.nsup);  
    }
    
    //Returns the intersection of the arguments
    inline f_interval operator &(const f_interval &a, const real &b)
    {
        return f_interval((a.inf>b)?a.inf:b,(-a.nsup<b)?-a.nsup:b);  
    }
//--------------END of Mathematical Functions----------------//

//-------------------Comparsion Functions--------------------//
        
    //Standard equality operation
    inline bool operator ==(const f_interval &a, const f_interval &b)
    {
        return (a.inf == b.inf && a.nsup == b.nsup);        
    }
    
    //Standard negated equality operation
    inline bool operator !=(const f_interval &a, const f_interval &b)
    {
        return (a.inf != b.inf || a.nsup != b.nsup);        
    }
    
    //Standard less-or-equal-than operation
    inline bool operator <=(const f_interval &a, const f_interval &b)
    {
        return (a.inf >= b.inf && a.nsup >= b.nsup);        
    }
    
    //Standard greater-or-equal-than operation
    inline bool operator >=(const f_interval &a, const f_interval &b)
    {
        return (a.inf <= b.inf && a.nsup >= b.nsup);        
    }
    
    //Standard greater-than operation
    inline bool operator >(const f_interval &a, const f_interval &b)
    {
        return (a.inf < b.inf && a.nsup > b.nsup);        
    }
    
    //Standard less-than operation
    inline bool operator <(const f_interval &a, const f_interval &b)
    {
        return (a.inf > b.inf && a.nsup < b.nsup);        
    }

//-------------------END of Comparsion Functions--------------------//
